package com.beyondsoft.sabg.edu.model.db.core;

import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.security.core.GrantedAuthority;

import javax.persistence.*;
import java.util.Set;

/**
 * @Author Mo cr
 * @Date 2023/8/4
 */
@Entity
@Data
@EqualsAndHashCode(callSuper = true)
@Table(name = "nothing-role")
public class Role extends BasicEntity implements GrantedAuthority {
    public static final String ROLE_USER = "ROLE_USER";
    public static final String ROLE_STUDENT = "ROLE_STUDENT";
    public static final String ROLE_SYS_ADMIN = "ROLE_ADMIN";
    public static final String ROLE_TEACHER = "ROLE_TEACHER";

    private String name;

    private String description;
    @ManyToMany(cascade = CascadeType.REFRESH,fetch = FetchType.EAGER)
    private Set<Privilege> privileges;

    @Override
    public String getAuthority() {
        return name;
    }
}



